from selenium.webdriver.common.by import By

from web_pratice.base_page import BasePage


class ContactPage(BasePage):
    _base_url = "https://work.weixin.qq.com/wework_admin/frame#contacts"
    def goto_addmember(self):
        # 在通讯录页面点击添加成员
        self.webdriver_wait(By.CSS_SELECTOR, ".js_has_member>div.js_operationBar_footer>a.js_add_member").click()
        from web_pratice.addmember_page import AddmemberPage
        # 跳转到添加成员页面
        return AddmemberPage(self.driver)

    def get_member(self):
        # 获取成员列表中所有的手机号
        eles = self.finds(By.CSS_SELECTOR,".member_colRight_memberTable_tr>td:nth-child(5)")
        phone_list = []
        for ele in eles:
            phone_list.append(ele.text)

        return phone_list
    # 删除第一个成员
    def delete_first_member(self):
        self.find()